package samoloty.data;

import java.util.ArrayList;
import samoloty.model.IDataModel;
import samoloty.model.models.AcRegModel;
import samoloty.model.models.ConfigurationModel;
import samoloty.model.models.ConstModel;
import samoloty.model.models.CrewModel;
import samoloty.model.models.FuelModel;
import samoloty.model.models.HoldsModel;
import samoloty.model.models.IdealTrimModel;
import samoloty.model.models.LimitLawModel;
import samoloty.model.models.LimitTowModel;
import samoloty.model.models.LimitTowffModel;
import samoloty.model.models.LimitZfwModel;
import samoloty.model.models.LimitZfwffModel;
import samoloty.model.models.MaxWeightsModel;
import samoloty.model.models.PantryModel;
import samoloty.model.models.PaxModel;
import samoloty.model.models.StabTrimModel;
import samoloty.model.models.StabTrimSubModel;
import samoloty.model.models.StabTrimSubSubModel;

public class DataBase6 extends CommonDataBase implements IDataModel {

    public DataBase6() {
        super();
        initData();
    }

    public ArrayList<String> getAcReg() {
        return acRegData;
    }

    public ArrayList<ConfigurationModel> getConfiguration() {
        return configuration;
    }

    public ConstModel getConst() {
        return constData;
    }

    public ArrayList<CrewModel> getCrew() {
        return crewData;
    }

    public ArrayList<FuelModel> getFuel() {
        return fuelData;
    }

    public ArrayList<HoldsModel> getHolds() {
        return holdsData;
    }

    public ArrayList<LimitLawModel> getLimitLaw() {
        return limitLawData;
    }

    public ArrayList<LimitTowModel> getLimitTow() {
        return limitTowData;
    }

    public ArrayList<LimitTowffModel> getLimitTowff() {
        return limitTowffData;
    }

    public ArrayList<LimitZfwModel> getLimitZfw() {
        return limitZfwData;
    }

    public ArrayList<LimitZfwffModel> getLimitZfwff() {
        return limitZfwffData;
    }

    public MaxWeightsModel getMaxWeights() {
        return maxWeightsData;
    }

    public PantryModel getPantry() {
        return pantryData;
    }

    public ArrayList<PaxModel> getPax() {
        return paxData;
    }

    public StabTrimModel getStabTrimFlap1() {
        return stabTrimFlap1Data;
    }

    public StabTrimModel getStabTrimFlap2() {
        return stabTrimFlap2Data;
    }

    public StabTrimModel getStabTrimFlap3() {
        return stabTrimFlap3Data;
    }

    public StabTrimModel getStabTrimFlap4() {
        return stabTrimFlap4Data;
    }

    public ArrayList<IdealTrimModel> getIdealTrim() {
        return idealTrimData;
    }

    private void initData() {
        initAcReg();
        initConst();
        initCrew();
        initConfiguratin();
        initFuel();
        initHolds();
        initLimitTow();
        initLimitZfw();
        initPantry();
        initPax();
        initMaxWeights();
        initStabTrimFlap1();
        initIdealTrim();
    }

    private void initAcReg() {
        acRegData = new ArrayList<String>();
        acRegData.add(new String("SP-LKC"));
        acRegData.add(new String("SP-LKD"));
        acRegData.add(new String("SP-LKE"));
        acRegData.add(new String("SP-LKF"));

    }

    private void initConst() {
        constData = new ConstModel(30000, 40, 648.5, 625.6, 134.5);
    }

    private void initCrew() {
        crewData = new ArrayList<CrewModel>();
        crewData.add(new CrewModel("2/0", 2, 0, 170, -2.372));
        crewData.add(new CrewModel("2/3", 2, 3, 395, -3.248));
        crewData.add(new CrewModel("2/4", 2, 4, 470, -2.322));
        crewData.add(new CrewModel("2/5", 2, 5, 545, -1.396));
        crewData.add(new CrewModel("3/0", 3, 0, 255, -3.557));
        crewData.add(new CrewModel("3/3", 3, 3, 480, -4.434));
        crewData.add(new CrewModel("3/4", 3, 4, 555, -3.508));
        crewData.add(new CrewModel("3/5", 3, 5, 630, -2.582));

    }

    private void initConfiguratin() {
        configuration = new ArrayList<ConfigurationModel>();
        configuration.add(new ConfigurationModel("Y108", 0, 108, 0, 36, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C12Y96", 12, 96, 12, 24, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C18Y90", 18, 90, 18, 18, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C24Y84", 24, 84, 24, 12, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C30Y78", 30, 78, 30, 6, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C36Y72", 36, 72, 36, 0, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C42Y66", 42, 66, 36, 0, 6, 18, 0, 48));
        configuration.add(new ConfigurationModel("C48Y60", 48, 60, 36, 0, 12, 12, 0, 48));
        configuration.add(new ConfigurationModel("C54Y54", 54, 54, 36, 0, 18, 6, 0, 48));
        configuration.add(new ConfigurationModel("C60Y48", 60, 48, 36, 0, 24, 0, 0, 48));
        configuration.add(new ConfigurationModel("C66Y42", 66, 42, 36, 0, 24, 0, 6, 42));
        configuration.add(new ConfigurationModel("C72Y36", 72, 36, 36, 0, 24, 0, 12, 36));
        configuration.add(new ConfigurationModel("C78Y30", 78, 30, 36, 0, 24, 0, 18, 30));
        configuration.add(new ConfigurationModel("C84Y24", 84, 24, 36, 0, 24, 0, 24, 24));
        configuration.add(new ConfigurationModel("C90Y18", 90, 18, 36, 0, 24, 0, 30, 18));
        configuration.add(new ConfigurationModel("C108", 108, 0, 36, 0, 24, 0, 48, 0));
        configuration.add(new ConfigurationModel("C8Y96", 8, 96, 8, 24, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C12Y90", 12, 90, 12, 18, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C16Y84", 16, 84, 16, 12, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C20Y78", 20, 78, 20, 6, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C24Y72", 24, 72, 24, 0, 0, 24, 0, 48));
        configuration.add(new ConfigurationModel("C28Y66", 28, 66, 24, 0, 4, 18, 0, 48));
        configuration.add(new ConfigurationModel("C32Y60", 32, 60, 24, 0, 8, 12, 0, 48));
        configuration.add(new ConfigurationModel("C36Y54", 36, 54, 24, 0, 12, 6, 0, 48));
        configuration.add(new ConfigurationModel("C40Y48", 40, 48, 24, 0, 16, 0, 0, 48));
        configuration.add(new ConfigurationModel("C44Y42", 44, 42, 24, 0, 16, 0, 4, 42));
        configuration.add(new ConfigurationModel("C48Y36", 48, 36, 24, 0, 16, 0, 8, 36));
        configuration.add(new ConfigurationModel("C52Y30", 52, 30, 24, 0, 16, 0, 12, 30));
        configuration.add(new ConfigurationModel("C56Y24", 56, 24, 24, 0, 16, 0, 16, 24));
        configuration.add(new ConfigurationModel("C60Y18", 60, 18, 24, 0, 16, 0, 20, 18));
        configuration.add(new ConfigurationModel("C72", 72, 0, 24, 0, 16, 0, 32, 0));

    }

    private void initFuel() {
        fuelData = new ArrayList<FuelModel>();
        fuelData.add(new FuelModel(0, 0.0));
        fuelData.add(new FuelModel(500, -0.7));
        fuelData.add(new FuelModel(1000, -1.2));
        fuelData.add(new FuelModel(1500, -1.7));
        fuelData.add(new FuelModel(2000, -2.1));
        fuelData.add(new FuelModel(2500, -2.4));
        fuelData.add(new FuelModel(3000, -2.7));
        fuelData.add(new FuelModel(3500, -3.0));
        fuelData.add(new FuelModel(4000, -3.2));
        fuelData.add(new FuelModel(4500, -3.4));
        fuelData.add(new FuelModel(5000, -3.5));
        fuelData.add(new FuelModel(5500, -3.7));
        fuelData.add(new FuelModel(6000, -3.7));
        fuelData.add(new FuelModel(6500, -3.8));
        fuelData.add(new FuelModel(7000, -3.6));
        fuelData.add(new FuelModel(7500, -3.0));
        fuelData.add(new FuelModel(8000, -2.1));
        fuelData.add(new FuelModel(8500, -1.0));
        fuelData.add(new FuelModel(9000, 0.3));
        fuelData.add(new FuelModel(9111, 0.7));
        fuelData.add(new FuelModel(9500, 0.1));
        fuelData.add(new FuelModel(10000, -0.7));
        fuelData.add(new FuelModel(10500, -1.4));
        fuelData.add(new FuelModel(11000, -2.2));
        fuelData.add(new FuelModel(11500, -3.0));
        fuelData.add(new FuelModel(12000, -3.8));
        fuelData.add(new FuelModel(12500, -4.5));
        fuelData.add(new FuelModel(13000, -5.3));
        fuelData.add(new FuelModel(13500, -6.1));
        fuelData.add(new FuelModel(14000, -6.8));
        fuelData.add(new FuelModel(14500, -7.6));
        fuelData.add(new FuelModel(15000, -8.4));
        fuelData.add(new FuelModel(15500, -9.3));
        fuelData.add(new FuelModel(16000, -10.3));
        fuelData.add(new FuelModel(16140, -10.6));

    }

    private void initHolds() {
        holdsData = new ArrayList<HoldsModel>();
        holdsData.add(new HoldsModel("1", 703, -0.00866));
        holdsData.add(new HoldsModel("2", 869, -0.00613));
        holdsData.add(new HoldsModel("3", 1756, 0.00477));
        holdsData.add(new HoldsModel("4", 1132, 0.00938));

    }

    private void initLimitZfw() {
        limitZfwData = new ArrayList<LimitZfwModel>();
        limitZfwData.add(new LimitZfwModel(25000, 34.6, 25000, 44.32));
        limitZfwData.add(new LimitZfwModel(46493, 22.1, 27215, 46.17));
        limitZfwData.add(new LimitZfwModel(46493, 22.1, 31751, 50.65));
        limitZfwData.add(new LimitZfwModel(46493, 22.1, 40823, 62.04));
        limitZfwData.add(new LimitZfwModel(46493, 22.1, 46493, 64.21));

    }

    private void initLimitTow() {
        limitTowData = new ArrayList<LimitTowModel>();
        limitTowData.add(new LimitTowModel(25000, 34.62, 25000, 44.32));
        limitTowData.add(new LimitTowModel(46493, 22.08, 27215, 46.17));
        limitTowData.add(new LimitTowModel(49441, 20.02, 31751, 50.65));
        limitTowData.add(new LimitTowModel(50859, 22.8, 40823, 62.04));
        limitTowData.add(new LimitTowModel(52389, 24.42, 46493, 64.21));
        limitTowData.add(new LimitTowModel(52389, 24.42, 49895, 65.24));
        limitTowData.add(new LimitTowModel(52389, 24.42, 52389, 65.99));

    }

    private void initPantry() {
        pantryData = new PantryModel(948, -0.01029, 0, 0.00000, 762, 0.01398);

    }

    private void initPax() {
        paxData = new ArrayList<PaxModel>();
        paxData.add(new PaxModel("0A", -0.00572));
        paxData.add(new PaxModel("0B", -0.00003));
        paxData.add(new PaxModel("0C", 0.00648));

    }

    private void initMaxWeights() {
        maxWeightsData = new MaxWeightsModel(52616, 52389, 46493, 49895);
    }

    private void initStabTrimFlap1() {
        ArrayList<StabTrimSubModel> stabTrimSub = new ArrayList<StabTrimSubModel>();
        ArrayList<StabTrimSubSubModel> stabMacs1 = new ArrayList<StabTrimSubSubModel>();
        stabMacs1.add(new StabTrimSubSubModel(5, 5.9));
        stabMacs1.add(new StabTrimSubSubModel(30, 2.0));
        stabTrimSub.add(new StabTrimSubModel("FLAPS 5 & 15", 25000, stabMacs1));
        ArrayList<StabTrimSubSubModel> stabMacs2 = new ArrayList<StabTrimSubSubModel>();
        stabMacs2.add(new StabTrimSubSubModel(5, 6.4));
        stabMacs2.add(new StabTrimSubSubModel(30, 2.5));
        stabTrimSub.add(new StabTrimSubModel("", 52389, stabMacs2));
        stabTrimFlap1Data = new StabTrimModel(stabTrimSub);
    }

    private void initIdealTrim() {
        idealTrimData = new ArrayList<IdealTrimModel>();
        idealTrimData.add(new IdealTrimModel(30000, 49));
        idealTrimData.add(new IdealTrimModel(46493, 54));

    }

    public String getLabel() {
        return "B737-500";
    }
    private ArrayList<String> acRegData;
    private ConstModel constData;
    private ArrayList<CrewModel> crewData;
    private ArrayList<ConfigurationModel> configuration;
    private ArrayList<FuelModel> fuelData;
    private ArrayList<HoldsModel> holdsData;
    private ArrayList<LimitZfwModel> limitZfwData;
    private ArrayList<LimitTowModel> limitTowData;
    private ArrayList<LimitLawModel> limitLawData;
    private ArrayList<LimitZfwffModel> limitZfwffData;
    private ArrayList<LimitTowffModel> limitTowffData;
    private PantryModel pantryData;
    private ArrayList<PaxModel> paxData;
    private MaxWeightsModel maxWeightsData;
    private StabTrimModel stabTrimFlap1Data;
    private StabTrimModel stabTrimFlap2Data;
    private StabTrimModel stabTrimFlap3Data;
    private StabTrimModel stabTrimFlap4Data;
    private ArrayList<IdealTrimModel> idealTrimData;
}
